﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="BlogDH.Login" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Login Page</title>
    <link href="../Css/login.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" action="login.aspx" method="post">
    <div class="nav">
        <a href="index.aspx">返回首页</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="register.aspx">
            新站录入</a>
    </div>
    <div class="content">
        <label class="label">
            博客域名：</label>
        <input type="text" id="uname" name="uname" maxlength="50" value="<%=username %>"
            onfocus="if(this.value=='如:blogdh.com') this.value=''" onblur="checkDomain();" />
        <div class="clear">
        </div>
        <label class="label">
            密码：</label>
        <input type="password" id="pwd" name="pwd" />
        <div class="clear">
        </div>
        <span id="error">
            <%=errorStr %></span>
        <br />
        <br />
        <input type="submit" class="button" name="commit" value="登录" onclick="return checkDomain()" /></div>
    </form>
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <script type="text/javascript">
        function checkDomain() {
            var domain = document.getElementById("uname").value.replace("http://", "").replace("www.", "");
            if (domain == "") {
                var domain = document.getElementById("uname").value = "如:blogdh.com";
                document.getElementById("error").innerHTML = "请输入域名";
                return false;
            } else if (domain == "如:blogdh.com") {
                document.getElementById("error").innerHTML = "请输入域名";
                return false;
            }
            document.getElementById("uname").value = domain;
            var patrn = /^[0-9a-zA-Z]+[0-9a-zA-Z\.-]*\.[a-zA-Z]{2,4}$/;
            if (patrn.test(domain)) {
                return true;
            } else {
                document.getElementById("error").innerHTML = "域名格式输入错误";
                return false;
            }
        }
    </script>
</body>
</html>
